import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '基地编号',
    align: "center",
    dataIndex: 'no',
    helpMessage: '租户编号+2位自增流水号，例子：1000-01，1000-02，1001-01其中1000和1001代表租户编号'
  },
  {
    title: '基地名称',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '地块数量',
    align: "center",
    dataIndex: 'plotTotal',
  },

  {
    title: '产业分类',
    align: "center",
    dataIndex: 'classification_dictText'
  },
  {
    title: '基地地址',
    align: "center",
    dataIndex: 'poi'
  },
  {
    title: '环境描述',
    align: "center",
    dataIndex: 'environment'
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "基地名称",
    field: 'name',
    component: 'Input',
    colProps: { span: 6 },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '基地名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入基地名称!' },
      ];
    },
  },
  {
    label: '产业分类',
    field: 'classification',
    component: 'JTreeSelect',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请选择产业分类!' },
      ];
    },
    componentProps: {
      dict: "t_classification,name,id",
      pidField: "pid",
      pidValue: "1661198368030584831",
      hasChildField: "has_child",
    },
  },
  {
    label: '环境描述',
    field: 'environment',
    component: 'InputTextArea',
  },
  {
    label: '基地照片',
    field: 'picture',
    component: 'JImageUpload',
    componentProps: {
      bizPath: null,
      fileMax: 10,
      multiple: true
    },
  },
  {
    label: '联系人',
    field: 'contactPerson',
    component: 'Input',
  },
  {
    label: '联系电话',
    field: 'contactPhone',
    component: 'Input',
  },
  {
    label: '基地面积',
    field: 'area',
    component: 'InputNumber',
  },
  {
    label: '基地地址',
    field: 'poi',
    component: 'AMap',
    componentProps: {
      edit: 'marker',
      search: true
    }
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
